<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<h2>거래처 정보</h2>

<form:form modelAttribute="buildingModel" method="post" action="" onsubmit="return companyForm.formChk(); return false;">
<form:hidden path="buildingDao.buildingCd" class="key"/>
<table class="form_table">
	<colgroup>
	<col width="120"/>
	<col width="*"/>
	<col width="120"/>
	<col width="*"/>
	</colgroup>
	<tbody>
		<tr><th colspan="6" class="title">시설기본정보</th></tr>
   		<tr>
			<th>시설명</th>
			<td colspan="3">
				<form:input path="buildingDao.buildingName" title="시설명" class="txt-220" dataType="CHAR" maxlength="64"/>
			</td>
			<th>측정 대상 구분</th>
			<td>
				<form:select path="buildingDao.measureTarget" title="[시설] 측정 대상 구분" items="${measureTargetList}" itemValue="code" itemLabel="name"></form:select>
			</td>
   		</tr>
   		<tr>
			<th>구주소</th>
			<td colspan="5">
				<span class="button medium openPostcode" postType="1"><button type="button" >구주소 찾기</button></span>
				<form:input path="buildingDao.buildingZipcode" title="[시설] 우편번호" class="skipData zipcode" dataType="CHAR" maxlength="7"/>
				<form:input path="buildingDao.buildingAddr" title="[시설] 구주소" class="addr" dataType="CHAR" maxlength="128"/>
			</td>
   		</tr>
   		<tr>
			<th>신주소</th>
			<td colspan="5">
				<span class="button medium openPostcode"><button type="button" >신주소 찾기</button></span>
				<form:input path="buildingDao.buildingNewAddr" title="[시설] 신주소" class="skipData addr" dataType="CHAR" maxlength="128"/>
			</td>
   		</tr>
   		<tr>
			<th>비고</th>
			<td colspan="5">
				<form:input path="buildingDao.buildingMemo" title="[시설] 특이사항" class="skipData input-box" dataType="CHAR" maxlength="258"/>
			</td>
   		</tr>
		<tr><th colspan="6" class="title">사업자정보</th></tr>
		<tr>
			<th>사업자명</th>
			<td colspan="3">
				<form:input path="buildingDao.companyName" title="사업자명" class="txt-200" dataType="CHAR" maxlength="64"/>
			</td>
			<th>사업자번호</th>
			<td>
				<form:input path="buildingDao.companyNumber" title="사업자번호" class="ssn txt-120" dataType="CHAR" maxlength="16"/>
			</td>
		</tr>
		<tr>
			<th>대표자명</th>
			<td>
				<form:input path="buildingDao.companyPresident" title="대표자명" class="txt-80" dataType="CHAR" maxlength="32"/>
			</td>
			<th>업태</th>
			<td>
				<form:input path="buildingDao.businessConditions" title="업태" class="skipData" dataType="CHAR" maxlength="128" />
			</td>
			<th>종목</th>
			<td>
				<form:input path="buildingDao.businessType" title="종목" class="skipData" dataType="CHAR" maxlength="128"/>
			</td>
		</tr>
		<tr>
			<th>사업장주소</th>
			<td colspan="3">
				<span class="button medium openPostcode"><button type="button" >사업장주소 찾기</button></span>
				<form:input path="buildingDao.businessAddr" title="사업장주소" class="addr skipData" dataType="CHAR" maxlength="128"/>
			</td>
			<th>사업장메일</th>
			<td>
				<form:input path="buildingDao.companyEmail" title="사업장메일" class="skipData email" dataType="CHAR" maxlength="128"/>
			</td>
		</tr>
	</tbody>
</table>
<div id="inchargeDiv" >
<div class="clearfix titleBox">
	<h3 class="floatL">담당자</h3>
	<div class="floatR">
		<span class="button medium" id="inchargeAdd"><button type="reset" >추가</button></span>
	</div>
</div>
<div id="inchargeDelItem"></div>
<table id="inchargeTable" class="tb_list">
	<thead>
		<tr>
			<th scope="row" >이름</th>
			<th scope="row" >부서</th>
			<th scope="row" >직위</th>
			<th scope="row" >전화</th>
			<th scope="row" >핸드폰</th>
			<th scope="row" >팩스</th>
			<th scope="row" >메일</th>
			<th scope="row" >비고</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${buildingModel.buildingDao.incharge}" var="inchargeList" varStatus="loop2">
			<tr class="item" idx="${loop2.index}">
				<td>
					<form:hidden path="buildingDao.incharge[${loop2.index}].inchargeCd" class="key" />
					<form:input path="buildingDao.incharge[${loop2.index}].inchargeName" title="담당자 이름" class="txt-80" dataType="CHAR" maxlength="16"/>
				</td>
				<td><form:input path="buildingDao.incharge[${loop2.index}].inchargeDepartment" title="담당자 부서" class="skipData txt-120" dataType="CHAR" maxlength="45"/></td>
				<td><form:input path="buildingDao.incharge[${loop2.index}].inchargeRank" title="담당자 직위" class="skipData txt-80" dataType="CHAR" maxlength="64"/></td>
				<td><form:input path="buildingDao.incharge[${loop2.index}].inchargeTel" title="담당자 전화" class="tel" /></td>
				<td><form:input path="buildingDao.incharge[${loop2.index}].inchargePhone" title="담당자 핸드폰" class="skipData tel" /></td>
				<td><form:input path="buildingDao.incharge[${loop2.index}].inchargeFax" title="담당자 팩스" class="skipData tel" /></td>
				<td><form:input path="buildingDao.incharge[${loop2.index}].inchargeEmail" title="담당자 메일" class="skipData email" dataType="CHAR" maxlength="64"/></td>
				<td>
					<form:input path="buildingDao.incharge[${loop2.index}].inchargeMemo" title="담당자 특이사항" class="skipData txt-165" dataType="CHAR" maxlength="248"/>
					<span class="button small icon inchargeDel"><span class="delete"></span></span>
				</td>
			</tr>
		</c:forEach>
	</tbody>
</table><!-- /widget-content -->
</div>
<div id="estimateDiv">
<div class="clearfix titleBox">
	<h3 class="floatL">측정정보</h3>
	<div class="floatR">
		<span class="button medium" id="estimateAdd"><button type="reset" >추가</button></span>
	</div>
</div>
<div id="estimateDelItem"></div>
<table id="estimateTable" class="tb_list">
	<thead>
		<tr>
			<th scope="row" >견적일</th>
			<th scope="row" >측정일</th>
			<th scope="row" >측정타입</th>
			<th scope="row" >부가세여부</th>
			<th scope="row" >금액</th>
			<th scope="row" >비고</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${buildingModel.buildingDao.estimate}" var="estimate" varStatus="loop2">
			<tr class="item" idx="${loop2.index}">
				<td>
					<form:hidden path="buildingDao.estimate[${loop2.index}].estimateCd" class="key" />
					<form:input path="buildingDao.estimate[${loop2.index}].estimatDate" title="견적일" class="estimatDate skipData date"/>
				</td>
				<td><form:input path="buildingDao.estimate[${loop2.index}].measureDate" title="측정일" class="measureDate skipData date"/></td>
				<td>
					<form:select path="buildingDao.estimate[${loop2.index}].measureType" title="측정타입" items="${measureTypeList}" itemValue="code" itemLabel="name"></form:select>
				</td>
				<td>
					<form:select path="buildingDao.estimate[${loop2.index}].estimatSurtax" title="부가세여부" items="${estimatSurtaxList}" itemValue="code" itemLabel="name"></form:select>
				</td>
				<td><form:input path="buildingDao.estimate[${loop2.index}].estimatSum" title="금액" class="estimatSum skipData txt-right txt-80" /></td>
				<td>
					<form:input path="buildingDao.estimate[${loop2.index}].estimatMemo" title="비고" class="skipData txt-165" />
					<span class="button small icon estimateDel"><span class="delete"></span></span>
				</td>
			</tr>
		</c:forEach>
	</tbody>
</table><!-- /widget-content -->
</div>
<div class="clearfix top10">
	<div class="floatR">
		<span class="button medium"><button type="reset" >새로고침</button></span>
		<span class="button medium"><button type="submit" >저장</button></span>
		<span class="button medium"><a href="<c:url value='/search'/>" class="btn">목록</a></span>
	</div>
</div>

</form:form>
<script src="http://dmaps.daum.net/map_js_init/postcode.js"></script>
<script type="text/javascript" src="<c:url value='/res/js/content/building/form.js'/>"></script>
